function alertar() {
	alert('teste');
}

function fechar() {
	document.getElementById('popup').style.display = 'none';
	document.getElementById('mask').style.display = 'none';
}

function abrir() {
	$("#popup").fadeToggle();
	$("#mask").fadeToggle();
}
function trocaordem() {
	document.getElementById("popup").style.zIndex = "1";
}

function fade(eid, initOp, finalOp, TimeToFade, time)
{

    if (initOp==0)
    {
        document.getElementById(eid).style.visibility="visible";
    }
    var curTick = new Date().getTime();
    var elapsedTicks = curTick - time;
    var newOp = initOp+(finalOp-initOp)*elapsedTicks/TimeToFade;
    if (Math.abs(newOp-initOp) > Math.abs(finalOp-initOp))
    {
        document.getElementById(eid).style.opacity=finalOp;
        if (finalOp==0)
        {
            document.getElementById(eid).style.visibility="hidden";
        }
        return;
    }
    document.getElementById(eid).style.opacity=newOp;
    setTimeout("fade( '" + eid + "'," + initOp + "," + finalOp + "," + TimeToFade + "," + time + ")", TimeToFade/100);
}


